const Mock = require('mockjs');
const jwt = require('jsonwebtoken');

let data = Mock.mock({
    "list|60":[{
        "id":"@id",
        "user":"@cname",
        "tel|123456-654321":0,
        "city":"@city",
        "date":"@date",
    }]
})

module.exports = {
    //...
    devServer: {
        compress: true,
        port: 9000,
        before(app){
            app.get('/api/Login',(req,res)=>{
                res.send({
                    code:200,
                    message:'登录成功',
                    token:'Bearer ' + jwt.sign({ foo: 'bar' }, 'shhhhh'),
                });
            })

            app.get('/api/list',(req,res)=>{
                res.send(data.list);
            })
        }
    },
};